import Vue from "vue";
import App from "@/App.vue";
import router from "@/router";
import store from "@/store";
import ElementUI from "element-ui";

import "element-ui/lib/theme-chalk/index.css";
import "@/assets/scss/index.scss";
import "@/icons";
import "@/components/global";
import cloneDeep from "lodash/cloneDeep";
// 保存整站vuex本地储存初始状态
window["storeState"] = cloneDeep(store.state);
import way from "@/utils/way.js";
import regEx from "@/utils/regEx.js";
import company from "@/utils/company_deploy.js";
import date from "@/utils/getDateTime.js";
import http from "@/api/index";
import mixins from "@/mixins/utils.js";

Vue.prototype.$way = way;
Vue.prototype.$regEx = regEx;
Vue.prototype.$company = company;
Vue.prototype.$date = date;
Vue.prototype.apis = http;
window["storeState"]["company"] = company;

import * as filters from "./filters";
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]); // 插入过滤器名和对应方法
});

// 挂载全局
import {
  parseTime,
  resetForm,
  addDateRange,
  selectDictLabel,
  selectDictLabels,
  download,
  handleTree,
} from "@/utils/dlc";
// Vue.prototype.getDicts = getDicts
// Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime;
Vue.prototype.resetForm = resetForm;
Vue.prototype.addDateRange = addDateRange;
Vue.prototype.selectDictLabel = selectDictLabel;
Vue.prototype.selectDictLabels = selectDictLabels;
Vue.prototype.download = download;
Vue.prototype.handleTree = handleTree;

Vue.config.productionTip = false;

Vue.use(ElementUI);
Vue.mixin(mixins);

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
